package org.example.controller;

import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A;
import org.example.Result;
import org.example.api.ClueServiceApi;
import org.example.clue.entity.Clue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;
import java.util.Objects;

@RestController
public class ClueController {
//    @Autowired
//    private RestTemplate restTemplate;
    @Autowired
    private ClueServiceApi clueServiceApi;
    @GetMapping
    public Result<List<Clue>> getAll(){
        //通过ip+端口号
//        return  restTemplate.getForObject("http://localhost:8080/clue",Object.class);
        //通过微服务名字
//        return restTemplate.getForObject("http://clue-noc/clue",Object.class);
        //通过接口调用微服务（open Feign）
        return  clueServiceApi.getAll();
    }

}